package ast;

import compiler.OutputFormatter;

public class WhileStatement extends Statement {
	private Operation operation;
	private StatementList whileStatement;
	
	public WhileStatement(Operation operation, StatementList whileStatement) {
		setOperation(operation);
		setWhileStatement(whileStatement);
	}

	@Override
	public void genC(OutputFormatter of) {
		of.output("while");
		operation.genC(of);
		of.space();
		of.output("{");
		of.endLine();
		of.increaseIndent();
		whileStatement.genC(of);
		of.decreaseIndent();
		of.output("}");
		of.endLine();
		//super.genC(of);
	}	
	
	
	public Operation getOperation() {
		return operation;
	}
	public StatementList getWhileStatement() {
		return whileStatement;
	}
	public void setOperation(Operation operation) {
		this.operation = operation;
	}
	public void setWhileStatement(StatementList whileStatement) {
		this.whileStatement = whileStatement;
	}

}
